package com.park.common.poo;

import javax.persistence.*;

/**
 * Created by Administrator on 2017-04-30.
 */
@Entity
@Table(name = "system_role_function", schema = "", catalog = "totem")
@IdClass(SystemRoleFunctionPK.class)
public class SystemRoleFunction {
    private Integer roleId;
    private String functionId;

    @Id
    @Column(name = "roleId")
    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    @Id
    @Column(name = "functionId")
    public String getFunctionId() {
        return functionId;
    }

    public void setFunctionId(String functionId) {
        this.functionId = functionId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SystemRoleFunction that = (SystemRoleFunction) o;

        if (roleId != that.roleId) return false;
        if (functionId != null ? !functionId.equals(that.functionId) : that.functionId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = roleId;
        result = 31 * result + (functionId != null ? functionId.hashCode() : 0);
        return result;
    }
}
